import request from "@/utils/request";

// 查询订单列表
export function listOrder(query) {
  return request({
    url: "/md/order/list",
    method: "get",
    params: query,
  });
}

// 查询订单详细
export function getOrder(proOrderId) {
  return request({
    url: "/md/order/" + proOrderId,
    method: "get",
  });
}

// 新增订单
export function addOrder(data) {
  return request({
    url: "/md/order",
    method: "post",
    data: data,
  });
}

// 修改订单
export function updateOrder(data) {
  return request({
    url: "/md/order",
    method: "put",
    data: data,
  });
}

// 删除订单
export function delOrder(proOrderId) {
  return request({
    url: "/md/order/" + proOrderId,
    method: "delete",
  });
}

// 审核
export function auditOrder(query) {
  return request({
    url: "/md/order/audit",
    method: "get",
    params: query,
  });
}

// 返单
export function getCustomerOrderInfo(query) {
  return request({
    url: "/md/order/getCustomerOrderInfo",
    method: "get",
    params: query,
  });
}

// 新增变更单
export function addProOrder(data) {
  return request({
    url: "/pro/variationOrder",
    method: "post",
    data: data,
  });
}

// 修改变更单
export function updateProOrder(data) {
  return request({
    url: "/pro/variationOrder",
    method: "put",
    data: data,
  });
}

// 查询变更单列表
export function listProOrder(query) {
  return request({
    url: "/pro/variationOrder/list",
    method: "get",
    params: query,
  });
}

// 查询变更单详细
export function getProOrder(variationOrderId) {
  return request({
    url: "/pro/variationOrder/" + variationOrderId,
    method: "get",
  });
}

// 删除变更单
export function delProOrder(variationOrderIds) {
  return request({
    url: "/pro/variationOrder/" + variationOrderIds,
    method: "delete",
  });
}

// 查询推进记录
export function listOrderProgressPushRecord(query) {
  return request({
    url: "/md/orderProgressPushRecord/list",
    method: "get",
    params: query,
  });
}
//变更单财务审核
export function updatemoneyProOrder(query,money) {
  return request({
    url: "/md/order/financialAudit?orderId="+query+"&rebateAmount="+money,
    method: "get",
  });
}
//客户提交变更单，待财务审核
export function changeOrder(variationOrderIds) {
  return request({
    url: "/md/order/customerServiceSubmission/" + variationOrderIds,
    method: "get",
  });
}
// 新增变更单
export function copyOrder(query, data = null) {
  return request({
    url: "/md/order/copyOrder",
    method: "post",
    params: query,
    data: data,
  });
}
//暂停生产
export function stopproduct(orderId) {
  return request({
    url: "/md/order/suspendOrder/"+orderId,
    method: "get",
  });
}

//关闭订单
export function closeproduct(orderId) {
  return request({
    url: "/md/order/closeSubmit/"+orderId,
    method: "get",
  });
}
//恢复订单
export function recoverOrder(orderId) {
  return request({
    url: "/md/order/recoverOrder/"+orderId,
    method: "get",
  });
}
//财务审核关闭订单
export function closeOrder(orderId) {
  return request({
    url: "/md/order/closeOrder/"+orderId,
    method: "get",
  });
}




